﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ForzaGT3.Data;

namespace ForzaGT3.Controllers
{
    public partial class NewsController : Controller
    {
        //
        // GET: /News/

        public virtual ActionResult Index(int? page)
        {
            IEnumerable<News> data = News.GetAll()
                .Where(x => x.IsPublished == true)
                .OrderByDescending(m => m.CreatedDate);

            ViewBag.totalRecords = data.Count();

            return View(data);
        }

        public virtual ActionResult Details(string Id)
        {
            News data = null;
            data = News.GetByUrl(Id);

            return View(data);
        }

    }
}
